<script setup>
import { ref, onMounted } from 'vue'
import { userList } from '@/hooks/index.js'
import { deliveryList } from '@/apis/task.js'
const params = {
	page: 1,
	pageSize: 10,
	status: 2 // 区分是哪个状态的数据
}
const { getList, Refresh, list, isTriggered } = userList(deliveryList, params)
console.log('在途', list.value.length)
</script>
<template>
	<scroll-view @refresherrefresh="Refresh" refresher-enabled :refresher-triggered="isTriggered" scroll-y class="scroll-view">
		<view class="scroll-view-wrapper">
			<view class="task-card" v-for="delivery in list" :key="delivery.id">
				<navigator hover-class="none" :url="`/subpkg_task/detail/index?id=${delivery.id}`">
					<view class="header">
						<text class="no">任务编号: {{ delivery.transportTaskId }}</text>
					</view>
					<view class="body">
						<view class="timeline">
							<view class="line">{{ delivery.startAddress }}</view>
							<view class="line">{{ delivery.endAddress }}</view>
						</view>
					</view>
				</navigator>
				<view class="footer">
					<view class="label">到货时间</view>
					<view class="time">{{ delivery.planArrivalTime }}</view>
					<navigator v-if="list[0].status === 2" hover-class="none" :url="`/subpkg_task/delivery/index?id=${delivery.id}`" class="action">交付</navigator>
					<navigator
						v-if="list[0].status === 4"
						hover-class="none"
						:url="`/subpkg_task/record/index?id=${delivery.transportTaskId}&planArrivalTime=${delivery.planArrivalTime}`"
						class="action"
					>
						回车登记
					</navigator>
				</view>
			</view>
			<view v-if="list.length === 0" class="task-blank">无在途货物</view>
		</view>
	</scroll-view>
</template>

<style lang="scss" scoped>
@import './styles.scss';
</style>
